package theMemoryModel;

import java.util.ArrayList;

/**
 * @author Jamie Nie
 * @title: HeapTest
 * @projectName jvm-exercise
 * @Slogan: The harder you work, the more luck you have.
 * @date 2021/6/20 0020 22:54
 * @description: 内存溢出演示（java.lang.OutOfMemoryError）。可用 VisualVM观察GC情况
 */
public class HeapTest {
    byte[] bytes = new byte[1024 * 100];

    public static void main(String[] args) throws InterruptedException {
        ArrayList<HeapTest> heapTests = new ArrayList<>();
        while (true){
            heapTests.add(new HeapTest());
            Thread.sleep(5);
        }
    }
}
